packetbeat.interfaces:
  device: {{ bind_interface }}
  type: af_packet
  buffer_size_mb: 100
  with_vlans: yes

packetbeat.flows:
  enabled: true
  timeout: 30s
  period: 120s

packetbeat.protocols:
  - type: icmp
    enabled: true
{% if 'redis' in group_names %}
  - type: redis
    ports: [6379]
{% endif %}

{% if 'haproxy' in group_names %}
packetbeat.procs:
  monitored:
    - process: haproxy
      cmdline_grep: haproxy
{% endif %}

{% if (groups['redis'] | length) >= 3 %}
output.redis:
  hosts: ["redis.service.{{ consul_dc_name }}.consul"]
  key: "packetbeat"
  db: 2
  timeout: 5
{% else %}
output.logstash:
  hosts: ["logstash.service.{{ consul_dc_name }}.consul:{{ logstash_beats_port }}"]
  compression_level: 5
  timeout: 300
  slow_start: true
{% endif %}

#============================== Dashboards =====================================
setup.dashboards:
  enabled: true
  retry:
    enabled: true
    interval: 60s
    maximum: 10

#================================ Kibana =====================================
setup.kibana:
  host: "kibana.service.{{ consul_dc_name }}.consul"

#================================ Logging =====================================
logging.to_files: true
logging.level: error
logging.files:
  rotateeverybytes: 10485760 # = 10MB
  keepfiles: 7

fields_under_root: true
fields:
    beat_type: packetbeat

name: {{ inventory_hostname }}

tags: [
{%- for item in group_names -%}
  "{{ item }}"{%- if loop.nextitem is defined -%},{%- endif -%}
{%- endfor -%}
]
